<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%organization}}".
 *
 * @property integer $id
 * @property string $name
 * @property string $org_type
 * @property integer $evaluation_type
 * @property string $icon
 * @property integer $root
 * @property string $description
 * @property string $code
 * @property string $org_code
 * @property integer $province_id
 * @property integer $city_id
 * @property integer $area_id
 * @property string $address
 * @property string $telephone
 * @property string $zip_code
 * @property string $fax
 * @property string $email
 * @property string $website
 * @property integer $teacher_num
 * @property integer $student_num
 * @property integer $guardian_num
 * @property string $remark
 * @property integer $created_by
 * @property integer $created_at
 * @property integer $updated_by
 * @property integer $updated_at
 * @property integer $deleted_by
 * @property integer $deleted_at
 * @property integer $is_deleted
 * @property string $status
 */
class Organization extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%organization}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'evaluation_type', 'province_id', 'city_id', 'area_id'], 'required'],
            [['org_type', 'description', 'status'], 'string'],
            [['evaluation_type', 'root', 'province_id', 'city_id', 'area_id', 'teacher_num', 'student_num', 'guardian_num', 'created_by', 'created_at', 'updated_by', 'updated_at', 'deleted_by', 'deleted_at', 'is_deleted'], 'integer'],
            [['name'], 'string', 'max' => 50],
            [['icon', 'code', 'org_code', 'remark'], 'string', 'max' => 255],
            [['address'], 'string', 'max' => 500],
            [['telephone', 'fax'], 'string', 'max' => 45],
            [['zip_code'], 'string', 'max' => 6],
            [['email', 'website'], 'string', 'max' => 300],
            [['province_id'], 'exist', 'skipOnError' => true, 'targetClass' => District::className(), 'targetAttribute' => ['province_id' => 'id']],
            [['city_id'], 'exist', 'skipOnError' => true, 'targetClass' => District::className(), 'targetAttribute' => ['city_id' => 'id']],
            [['area_id'], 'exist', 'skipOnError' => true, 'targetClass' => District::className(), 'targetAttribute' => ['area_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '机构序号',
            'name' => '名称',
            'org_type' => '机构类型',
            'evaluation_type' => '评估类型：1.五大领域；2.高瞻',
            'icon' => '图标',
            'root' => '所属集团',
            'description' => '简介',
            'code' => '机构编码',
            'org_code' => '内部编码',
            'province_id' => '省',
            'city_id' => '市',
            'area_id' => '区',
            'address' => '地址',
            'telephone' => '联系电话',
            'zip_code' => '邮编',
            'fax' => '传真',
            'email' => '邮箱',
            'website' => '网址',
            'teacher_num' => '教师数',
            'student_num' => '学生数',
            'guardian_num' => '家长数',
            'remark' => '备注',
            'created_by' => '创建人',
            'created_at' => '创建时间',
            'updated_by' => '最后更新人',
            'updated_at' => '最后更新时间',
            'deleted_by' => '删除人',
            'deleted_at' => '删除时间',
            'is_deleted' => '是否已删除',
            'status' => '状态',
        ];
    }
}
